"""
RagFlow 客户端 GUI 配置功能模块
"""

from PySide6.QtWidgets import QMessageBox, QWidget, QVBoxLayout
from ragflow_client.gui.features.base_feature import BaseFeature


class ConfigFeature(BaseFeature):
    """配置功能类"""
    
    def __init__(self, parent=None):
        """初始化配置功能"""
        super().__init__(parent)
    
    def execute(self):
        """执行配置功能"""
        # 创建配置窗口
        content_widget = QWidget()
        layout = QVBoxLayout(content_widget)
        # 设置更紧凑的布局
        layout.setContentsMargins(10, 10, 10, 10)  # 减少边距
        layout.setSpacing(5)  # 减少间距
        
        # 创建配置选项卡组件
        from ragflow_client.gui.components.config_tab import ConfigTabWidget
        config_tab = ConfigTabWidget(self.parent)
        
        # 填充配置值
        if hasattr(self.parent, 'config'):
            config_tab.fill_config_values(self.parent.config)
        
        # 连接信号
        config_tab.config_saved.connect(self.parent.update_config)
        
        layout.addWidget(config_tab)
        
        # 创建窗口
        self.window = self.create_window("配置", content_widget)
        self.window.show()
